<el-row style="background: #fff; padding: 16px 16px 0; margin-bottom: 32px">
      <!-- <div class="btn topSubmitBtn" style="width:1220px">
      <el-button type="primary" @click="submit()">保存设置</el-button>
    </div> -->
      <div class="input-item">
        <el-form :model="deviceform"  label-width="250px">

          <div class="parameType-wrap">
            <div class="parameType">
              <div class="title">
                <span>基本参数配置</span>
                <el-button style="float: right; padding:4px 8px;" type="primary" @click="operationClick">确定</el-button>
              </div>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="设备状态上报周期:">
                  <el-input v-model="deviceform.report_status_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="每天指定时间自动重启设备:">
                  <!-- <el-input v-model="deviceform.reset_on_hours"></el-input> -->
                  <el-select v-model="deviceform.reset_on_hours" style="width:100%;">
                    <el-option value=0 label="不控制"></el-option>
                    <el-option v-for="item in 23" :key="item" :label="item + ':00'" :value="item"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="进程自检喂狗周期:">
                  <el-input v-model="deviceform.write_watch_dog_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="日志分页默认显示条数:">
                  <!-- <el-input v-model="deviceform.page_length"><span slot="append">条</span></el-input> -->
                  <el-select v-model="deviceform.page_length" style="width:100%;">
                    <el-option label="10条/页" value=10></el-option>
                    <el-option label="20条/页" value=20></el-option>
                    <el-option label="30条/页" value=30></el-option>
                    <el-option label="40条/页" value=40></el-option>
                    <el-option label="50条/页" value=50></el-option>
                    <el-option label="100条/页" value=100></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="日志默认显示天数:">
                  <el-input v-model="deviceform.default_log_days"><span slot="append">天</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="有线网口名称:">
                  <el-input v-model="deviceform.eth0_name"></el-input>
                </el-form-item>
              </el-col>
            </div>

            <div class="parameType">
              <div class="title">装置维护相关参数</div>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="连续运行多长时间自动重启设备:">
                  <el-input v-model="deviceform.reset_keep_run_seconds"><span slot="append">小时</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="每天指定时间自动重启设备:">
                  <!-- <el-input v-model="deviceform.reset_on_hours"></el-input> -->
                  <el-select v-model="deviceform.reset_on_hours" style="width:100%;">
                    <el-option value=0 label="不控制"></el-option>
                    <el-option v-for="item in 23" :key="item" :label="item + ':00'" :value="item"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="进程自检喂狗周期:">
                  <el-input v-model="deviceform.write_watch_dog_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="日志分页默认显示条数:">
                  <!-- <el-input v-model="deviceform.page_length"><span slot="append">条</span></el-input> -->
                  <el-select v-model="deviceform.page_length" style="width:100%;">
                    <el-option label="10条/页" value=10></el-option>
                    <el-option label="20条/页" value=20></el-option>
                    <el-option label="30条/页" value=30></el-option>
                    <el-option label="40条/页" value=40></el-option>
                    <el-option label="50条/页" value=50></el-option>
                    <el-option label="100条/页" value=100></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="日志默认显示天数:">
                  <el-input v-model="deviceform.default_log_days"><span slot="append">天</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="有线网口名称:">
                  <el-input v-model="deviceform.eth0_name"></el-input>
                </el-form-item>
              </el-col>
            </div>
            <div class="parameType">
              <div class="title">业务相关参数</div>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="加速审计策略:">
                  <el-radio-group v-model="deviceform.proxy_policy">
                    <el-radio label="0">不控制</el-radio>
                    <el-radio label="1">只允许配置的用户加速审计</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="上报新访问URL间隔:">
                  <el-input v-model="deviceform.report_new_url_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="同一个网址访问归并周期:">
                  <el-input v-model="deviceform.same_proxy_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="实时流量缓存周期:">
                  <el-input v-model="deviceform.real_stream_log_keep_seconds"><span slot="append">分钟</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="邮件通知状态更新间隔:">
                  <el-input v-model="deviceform.sync_email_notify_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <!-- <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="上送共享邮件账号间隔:">
                  <el-input v-model="deviceform.report_email_accounts_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="同步共享邮件账号间隔:">
                  <el-input v-model="deviceform.sync_email_share_accounts_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col> -->
            </div>
            <div class="parameType">
              <div class="title">网络相关参数</div>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="授权参数自动更新周期:">
                  <el-input v-model="deviceform.inner_refresh_param_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="上送设备状态信息间隔:">
                  <el-input v-model="deviceform.report_status_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="上送设备流量统计间隔:">
                  <el-input v-model="deviceform.report_stream_sum_log_interval"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="僵尸连接超时:">
                  <el-input v-model="deviceform.mainrsa_connect_zombie_timeout"><span slot="append">秒</span></el-input>
                </el-form-item>
              </el-col>
            </div>
            <div class="parameType">
              <div class="title">自动删除相关参数</div>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="执行日志自动删除时间点:">
                  <!-- <el-input v-model="deviceform.LogSaveDays"></el-input> -->
                  <el-select v-model="deviceform.AutoDelHours" style="width:100%;">
                    <el-option v-for="item in 23" :key="item" :label="item + ':00'" :value="item"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :xs="24" :sm="24" :lg="24">
                <el-form-item label="日志储存天数:">
                  <el-input v-model="deviceform.LogSaveDays"><span slot="append">天</span></el-input>
                  <!-- <el-select v-model="deviceform.AutoDelHours" style="width:100%;">
                    <el-option v-for="item in 24" :key="item" :label="item+':00'" :value="item"></el-option>
                  </el-select> -->
                </el-form-item>
              </el-col>
            </div>
          </div>
        </el-form>
      </div>

    </el-row>



    data() {
    return {
      deviceform:{
      },
      oldData:[],
    }
  },
  //生命周期 - 创建完成（访问当前this实例）
  created() {
    this.getData()
  },
  //生命周期 - 挂载完成（访问DOM元素）
  mounted() {},
  methods: {
    async getData(){
      const res = await connrequest('GetParamThreshhold')
      const res1 = await connrequest('GetParamLogCfg')
      let obj = {}
      res.Data.map( item  => {
        obj[item.Name] = item.Value
      })
      this.oldData = res.Data
      obj.reset_keep_run_seconds = obj.reset_keep_run_seconds === '0' ? '不控制' : obj.reset_keep_run_seconds
      this.deviceform = {...obj, ...res1.Data}
    },
    async submit(){
      this.deviceform.reset_keep_run_seconds = this.deviceform.reset_keep_run_seconds === '不控制' ? '0' : this.deviceform.reset_keep_run_seconds
      let number = /^\d+$/
      let character64 = /^.{1,64}$/
      if (!number.test(this.deviceform.reset_keep_run_seconds)) {
        this.$message.error("连续运行多长时间自动重启设备只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.write_watch_dog_interval)) {
        this.$message.error("进程自检喂狗周期只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.default_log_days)) {
        this.$message.error("日志默认显示天数只能填数字");
        return false;
      }
      if (!character64.test(this.deviceform.default_log_days)) {
        this.$message.error("有线网口名称不能超过63位字符");
        return false;
      }
      if (!number.test(this.deviceform.report_new_url_interval)) {
        this.$message.error("上报新访问URL间隔只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.same_proxy_interval)) {
        this.$message.error("同一个网址访问归并周期只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.real_stream_log_keep_seconds)) {
        this.$message.error("实时流量缓存周期只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.sync_email_notify_interval)) {
        this.$message.error("邮件通知状态更新间隔只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.report_email_accounts_interval)) {
        this.$message.error("上送共享邮件账号间隔只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.sync_email_share_accounts_interval)) {
        this.$message.error("同步共享邮件账号间隔只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.inner_refresh_param_interval)) {
        this.$message.error("授权参数自动更新周期只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.report_status_interval)) {
        this.$message.error("上送设备状态信息间隔只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.report_stream_sum_log_interval)) {
        this.$message.error("上送设备流量统计间隔只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.mainrsa_connect_zombie_timeout)) {
        this.$message.error("僵尸连接超时只能填数字");
        return false;
      }
      if (!number.test(this.deviceform.LogSaveDays)) {
        this.$message.error("日志储存天数只能填数字");
        return false;
      }
      this.oldData = this.oldData.map(item => {
        for (const key in this.deviceform) {
          if(item.Name === key){
            item.Value = this.deviceform[key]
          }
        }
        return item
      })
      const data = {
        Data: this.oldData
      }
      const res = await connrequest('SetParamThreshhold', data)
      const data1 = {
        Data:{
          AutoDelHours: this.deviceform.AutoDelHours * 1,
          LogSaveDays: this.deviceform.LogSaveDays * 1
        }
      }
      await connrequest('SetParamLogCfg', data1)
      if(res.Status.StatusCode === 0) {
        this.$message.success('保存成功')
        window.sessionStorage.setItem('DefaultLogDays', this.deviceform.default_log_days || 3)
        // window.sessionStorage.setItem('DefaultPageLength', this.deviceform.page_length || 10)
        this.getData()
      }
    }
  }



  /* @import url(); 引入css类 */
  .parameType-wrap{
    display:flex;
    flex-wrap: wrap;
  }
  ::v-deep.input-item{
    margin-top: 10px;
    .parameType{
      border: 1px solid #eceff5;
      border-radius: 3px;
      width: 600px;
      padding: 10px;
      margin: 10px 20px 10px 0px;
      box-shadow: 0 0 10px #eceff5;
      .title{
        border-bottom: 1px solid #eceff5;
        padding-bottom : 10px;
      }
    }
    .el-form-item{
      margin-bottom: 6px;
    }
    .el-input-group__append, .el-input-group__prepend{
      width: 60px;
      padding: 0;
      text-align: center;
    }
  }
  .title{
    margin-bottom: 20px;
  }
  ::v-deep.el-form-item{
    label{
      font-weight: 500;
    }
  }